package com.yonyou.pmclouds.basecom.condition;

import com.yonyou.iuap.tenant.utils.TenantSdkPropertyUtil;
import com.yonyou.pmclouds.ApplicationConsts;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * 判断是否专属云部署的条件，配合<p>org.springframework.context.annotation.Conditional</p>使用
 *
 * @see org.springframework.context.annotation.Conditional
 */
public class ExclusiveDeployCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String sys = TenantSdkPropertyUtil.getPropertyByKey("sysid");
        return !ApplicationConsts.APPLICATION_ID.equals(sys);
    }
}
